#!/bin/bash
mydir=`dirname "$0"`
uninstallToolPath="$mydir/UninstallerTool"
installBasePath="${2%/Red Giant Warp}"
installSubPath="Red Giant Warp"
payloadFile="${PACKAGE_PATH}/../../Resources/Payloads/Warp.warp.8995fbf3.pax.gz"
productName="Warp"
productNumber="112"
installProductStr=`/usr/bin/grep -i "\<${productName}\>" "/tmp/rgs.C867B87B_3A5F_42DF_A83E_089FEDA01D63_${productNumber}"`
if [ ! -z "${installProductStr}" ]; then
    /usr/bin/xattr -d com.apple.quarantine "${payloadFile}"
    /bin/mkdir -p "$2/${installSubPath}"
    pushd "$2/${installSubPath}"
    /bin/pax -rzf "${payloadFile}"
    popd
    "$uninstallToolPath" -a "keying" "Keying Suite" -a "keying.warp" "Warp" -a "keying.warp.AdobeCC17" "Warp for Adobe CC17" "${installBasePath}/${installSubPath}/RGCornerPin.plugin" "${installBasePath}/${installSubPath}/RGReflection.plugin" "${installBasePath}/${installSubPath}/RGShadow.plugin" "${installBasePath}/Red Giant Warp"
fi
